package com.example.bilibili.mapper;

import com.example.bilibili.domain.*;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
* @author 86158
* @description 针对表【bili_video】的数据库操作Mapper
* @createDate 2022-09-07 10:29:00
* @Entity com.example.bilibili.domain.BiliVideo
*/
@Component
public interface BiliVideoMapper extends BaseMapper<BiliVideo> {
    @Select("SELECT videoid, bili_user.userauthor, videotitle,coverImage,thumbs,coin,collection,videoPath FROM bili_video left join bili_user on uploaderId = bili_user.userId where auditingID=7 ")
    List<videovo> getvideoList();
    @Select("SELECT videoid, bili_user.userauthor, videotitle,coverImage,thumbs,coin,collection FROM bili_video left join bili_user on uploaderId = bili_user.userId where videotitle like CONCAT('%',#{check},'%')  or bili_user.userauthor like CONCAT('%',#{check},'%') ")
    List<videovo> getvideoListlike(@Param("check") String check);
    @Select("SELECT  userAuthor,userAvatar, content FROM bili_user left join comment on comment.userId=bili_user.userId where comment.videoId=#{videoid}")
    List<commentvo> getvideocomment(@Param("videoid") String videoid);
    @Select("SELECT  userAuthor,userAvatar, videotitle,videointrbriefing,uploadtime FROM bili_video left join bili_user on bili_video.uploaderId=bili_user.userId where bili_video.videoId=#{videoid}")
    vidinfovo getvideoinfo(@Param("videoid") String videoid);
    @Select("SELECT videoid, bili_user.userauthor, videotitle,coverImage,thumbs,coin,collection,videoPath,auditingID FROM bili_video left join bili_user on uploaderId = bili_user.userId where userId=#{userid} ")
    List<uservideovo> getuservideoList(Long userid);
}




